package prototype.pattern.demo;

import car.BasicCar;
import car.Ford;
import car.Nano;

/**
 * Created by 逸足天涯
 * Date: 2019/10/17.
 * Time: 16:18
 */
public class PrototypePatternEx {
    public static void main(String[] args) throws CloneNotSupportedException {
        System.out.println("***Prototyep Pattern Demo***");
        BasicCar nano_base = new Nano("Green Nano");
        nano_base.price = 100000;

        BasicCar ford_base = new Ford("Ford Yellow");
        ford_base.price = 500000;

        BasicCar bc1;
        //Clone Nano Object
        bc1 = nano_base.clone();
        // Price will be more than 100000 for sure
        bc1.price = nano_base.price + BasicCar.setPrice();
        System.out.println("Car is ：" + bc1.getModleName() + "and it price is Rs." + bc1.price);

        //Clone Nano Object
        bc1 = ford_base.clone();
        // Price will be more than 100000 for sure
        bc1.price = ford_base.price + BasicCar.setPrice();
        System.out.println("Car is ：" + bc1.getModleName() + "and it price is Rs." + bc1.price);


    }
}
